package com.woyou.ui.activity.orderdetail;

import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

import com.citaq.ideliver.R;
import com.woyou.bean.OrderDetail;

/**
 * 订单待支付状态 订单详情 订单log下面 对应显示的View
 * 
 * @author longtao.li
 *
 */
public class NewOrderOnlineViewCreater extends StateViewCreater implements OnClickListener {

	public NewOrderOnlineViewCreater(Context context, ViewControl uiControl, OrderDetail detail) {
		super(context, uiControl, detail);
	}

	// 实例化View[]中的元素和实现事件绑定等操作
	protected void createView() {
		// 实现事件绑定等操作
		mViewArr = new View[2];
		
		View view1 = View.inflate(mContext, R.layout.orderdetail_item_text_extend, null);
		
		TextView price = (TextView) view1.findViewById(R.id.price);
		price.setText("¥" + mDetail.getTotalPrice());
		
		View view2 = View.inflate(mContext, R.layout.orderdetial_item_towbutton, null);
		TextView button2 = (TextView) view2.findViewById(R.id.button2);
		button2.setText("我要支付");
		TextView button3 = (TextView) view2.findViewById(R.id.button3);
		button3.setText("取消订单");
		button2.setOnClickListener(this);
		button3.setOnClickListener(this);
		
		mViewArr[0] = view1;
		mViewArr[1] = view2;
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.button2:
			mUiControl.payAgain();
			break;
			
		case R.id.button3:
			mUiControl.popCancelDialog();
			break;
		}
	}

}
